<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;
global $uid;
JHTML::_('behavior.modal');
?>
<h2>Gallery</h2>
<p>&nbsp;</p>
<?php 
	$sql = "select * from #__gallery where status = 1 and category='galleries' and user_id =".$uid;
	$db	=& JFactory::getDBO();
	$db->setQuery($sql);
	$rows = $db->loadObjectList();
	if(count($rows)){
	?>
<ul class="list-gallery">
	<?php $i=0;
		foreach($rows as $row){
		$i++;
		$image = str_replace('images/','',$row->images);
		$image = 'images/background/'.$uid.'/gallery/'.$image;
	?>
    <li<?php echo ($i%4==0) ? ' class="end"': '';?>><a class="modal" href="<?php echo $image;?>" title="Preview Image"><img src="<?php echo $image;?>" width="134" height="100" alt=""></a><p class="title"><?php echo $row->name;?></p></li>
    <?php }?>
</ul>  
<?php }else{?>
	<p>There don't have any image.</p>
<?php }?>
